package com.WJY.dao;

import com.WJY.pojo.Teacher;
import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface TeacherMapper {

    //查询所有老师
    @Select("select * from mybatis.teacher")
    List<Teacher> getAllTeacher();

    //根据老师编号查老师
    @Select("select * from teacher where t_id = #{id}")
    @Results({
            @Result(column = "t_id", property = "tId"),
            @Result(column = "t_id", property = "tId", one = @One(select = "com.WJY.dao.StudentMapper.studentList"))
    })
    Teacher selOneTeacherById(int id);

}
